
import { defineStore } from 'pinia'
import userApi from '@/LC/api/user';
import socket from './socket.js';
import LC from '../LC/index.js';
const useMoneyStore = defineStore({
  id: 'money', // id必填，且需要唯一
  state: () => {
    return {
		walletOverview:{},
		fundsOverview:{},
		currencyOverview:{},
		withdrawalWay:{},
		rechargeWay:{},
		transferWay:{},
		bank:{},
		usdt:{},
    }
  },
  unistorage: {
  	// 初始化恢复前触发
  	beforeRestore(ctx) {},
  	// 初始化恢复后触发
  
  },
   actions: {
     // 设置token
     init(){
		 // this.moneyInit()
		 this.rechargeWayInIt()
		  // this.withdrawalWayInIt()
		  // this.bankinfo()
		  // this.usdtinfo()
		    // this.transferWayInIt()
	 },
	 moneyInit(){
		 
		this.walletOverviewInit()
		this.fundsOverviewInit()
		this.currencyOverviewInit()
		
	 },
	 
	 
	async  transferWayInIt(){
		 let res=await  LC.$api.pay.transferWay()
		 if(res.code===200){
		 	this.transferWay=res.data
		 }
	 },
	 async  bankinfo(){
	 	 let res=await  LC.$api.pay.bankInfo()
	 	 if(res.code===200){
	 	 	this.bank=res.data
	 	 }
	  },
	  async  usdtinfo(){
	  	 let res=await  LC.$api.pay.usdtInfo()
	  	 if(res.code===200){
	  	 	this.usdt=res.data
	  	 }
	   },
	 async rechargeWayInIt(){
		 let res=await  LC.$api.pay.rechargeconfig()
		 if(res.code===200){
		 	this.rechargeWay=res.data
		 }
	 },
	 async withdrawalWayInIt(){
	 		 let res=await  LC.$api.pay.withdrawalWay()
	 		 if(res.code===200){
	 		 	this.withdrawalWay=res.data
	 		 }
	 },
	async walletOverviewInit(){
		let res=await  LC.$api.pay.walletOverview()
		if(res.code===200){
			this.walletOverview=res.data
		}
	},
	async fundsOverviewInit(){
		let res=await  LC.$api.pay.fundsOverview()
		if(res.code===200){
			this.fundsOverview=res.data
		}
	},
	async currencyOverviewInit(){
		let res=await  LC.$api.pay.currencyOverview()
		if(res.code===200){
			this.currencyOverview=res.data
		}
	},
    },
	
})
 export default useMoneyStore;